<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Product</title>
  <link rel="stylesheet" th:href="@{/styles/styles.css}">
  <link rel="stylesheet" type="text/css" th:href="@{/styles/bootstrap.min.css}">
  <!-- 引用你的 CSS 文件 -->
</head>
<div th:class="alibaba-platform">
    <span class="platform-flag" th:text="AlibabaCloud"></span>
</div>
<body>
<div th:replace="header :: header"></div>
<main role="main">
    <div class="h-product container">
        <div class="row">
            <div class="col-md-6">
                <img class="product-image" alt="" th:src="@{${product.picture}}"/>
            </div>
            <div class="product-info col-md-5">
                <div class="product-wrapper">
                    <h2 th:text="${product.name}"></h2>
                    <p th:text="${product.description}"></p>

                    <form method="POST" action="/cart/add">
                        <input type="hidden" name="productId" th:value="${product.id}"/>
                        <input type="hidden" name="userId" value="1"/>
                        <div class="product-quantity-dropdown">
                            <select name="quantity" id="quantity">
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                                <option>4</option>
                                <option>5</option>
                                <option>10</option>
                            </select>
                            <img src="/static/icons/Hipster_DownArrow.svg" alt="">
                        </div>
                        <button type="submit" class="cymbal-button-primary">Add To Cart</button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- 如果有推荐内容 -->
    <div th:if="${recommendations != null}">
        <div th:replace="recommendations :: recommendations"></div>
    </div>

    <div class="ad" th:if="${ad}">
    <div th:fragment="text_ad">
      <div class="container py-3 px-lg-5 py-lg-5">
        <div role="alert">
          <strong>Ad</strong>
          <a th:href="${ad.redirectUrl}" rel="nofollow" target="_blank" th:text="${ad.text}"></a>
        </div>
      </div>
    </div>
  </div>

</main>

<div th:replace="footer :: footer"></div>
</body>
</html>
